<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        'use strict'
        
        // const target = {
        //     foo: 'xxx',
        //     bar: 'yyy'
        // }

        // const proxy =  new Proxy(target, {
        //     get(target, key, receiver) {
        //         return Reflect.get(target, key, receiver)
        //     },
        //     set(target, key, value, receiver) {
        //         return Reflect.set(target, key, value, receiver)
        //     },
        //     defineProperty (target, key) {
        //         return Reflect.deleteProperty(target, key)
        //     }
        // })

        // proxy.foo = 'zzz'

        const obj = {
            get foo() {
                console.log(this)
                return this.bar
            }
        }

        const proxy = new Proxy(obj, {
            get(target, key, receiver) {
                if(key === 'bar'){
                    return 'value - bar'
                }
                return Reflect.get(target, key, receiver)
            }
        })
        console.log(proxy.foo)

    </script>
</body>
</html>